def input_number(reminder):
    result = input(reminder)
    while ((not result.isdigit()) or int(result) < 1 or int(result) % 2 == 0):
        result = input(reminder)
    return int(result)


rows = input_number("请输入要打印的行数:")
mid = int((rows-1)/2)
for row in range(-mid, mid+1):  # 控制打印的行数
    for space in range(0, abs(row)):  # 打印每行前的空格
        print(" ", end="")
    for xing in range(0, rows-2*abs(row)):  # 打印每行的星号
        print("*", end="")
    print()  # 换行
